<?php
require_once('config.inc.php');//$pdo; $uid; ROOT

//$_SESSION['user']['power'] = 1;
if(empty($_SESSION['user']['power']) || (int)$_SESSION['user']['power'] <= 0){
	die('你没有足够的权限！');
}

//查询班级表
$sql = 'SELECT cid,cname FROM class_info';
$stmt_class = $pdo->query($sql);

?>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<script src="js/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
	<script src="js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<title>用户信息管理</title>
</head>
<body>
		<div class="">
	<div class="panel panel-default">
		<div class="panel-heading">
			<span style="font-size: 18px;">个人信息管理</span>
		</div>
		<div class="panel-body">
			<form id="f-select" class="form-horizontal" action="#" method="post">
				<div class="input-group">
					<label class="input-group-addon" for="clazz">班级：</label>
					<select class="form-control" name="clazz">
	                	<option value="00b">全部</option>
	                	<!--<option value="2018php">长沙2018PHP班(原五/六班合并)</option>
	                	<option value="2018java">长沙2018JAVA班(原八班)</option>
	                	<option value="2019php">长沙2019PHP班(原九/十班合并)</option>
	                	<option value="2020php">长沙11班(包括连钢人员)</option>-->
	                	<?php  
	                	while($row = $stmt_class->fetch(PDO::FETCH_ASSOC)){
							echo '<option value="'.$row['cid'].'">'.$row['cname'].'</option>';
						}
	                	?>
                	</select>
					<label class="input-group-addon" for="uname">姓名：</label>
					<input class="form-control" type="text" name="uname" id="uname" value="" />
					<span class="input-group-btn">
						<!--<input id="go-select" class="form-control btn btn-success" type="submit" name="gosub" id="gosub" value="查询" />-->
						<button class="btn btn-success" id="go-select">查询</button>
					</span>
				</div>
			</form>
		</div>
	</div>
	
	
	<table class="table table-bordered" border="" cellspacing="" cellpadding="">
		<thead>
			<tr>
				<th>姓名</th>
				<th>班级</th>
				<th>身份证</th>
				<th>地址</th>
				<th>电话</th>
				<th>家长</th>
				<th>称呼</th>
				<th>电话</th>
				<th>家长1</th>
				<th>称呼1</th>
				<th>电话1</th>
			</tr>
		</thead>
		<tbody id="tbody"></tbody>
		
		
		
		
		
		<!--导入数据页-->
		<!--<tr>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
			<td>Data</td>
		</tr>-->
	</table>
	<div id="img" class="thumbnail" style="position: fixed; bottom: 0px; right: 0px; max-height: 500px; display:none;z-index: 9999;overflow: hidden;">
		<img style="max-height: 500px;" src="img/huodeming_01.jpg"/>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		var tbody = $('#tbody')[0];
		$('#go-select').on('click',function(eve){
			eve.preventDefault();//阻止表单提交
			var formData = new FormData($('#f-select')[0]);//得到表单数据
			$.ajax({
				type: 'post',
	            url: 'admin-list.php',
	            data: formData,
	            dataType: 'text',
	            contentType: false, //上传文件必须
				processData: false, //上传文件必须
				success: function (result) {
					//alert(result);
	            	tbody.innerHTML = result;
	            },
	            error: function (err) {
	            	tbody.innerHTML = 'AJAX查询出错了！';
	            }
			});
		});
		$('#tbody').on('mouseover','.photo',function(eve){
			//$('#img').css('top',($(eve.currentTarget).offset().top + $(eve.currentTarget).outerHeight())+'px');
			//$('#img').css('left',($(eve.currentTarget).offset().left + $(eve.currentTarget).outerWidth()) + 'px');
			$('#img>img')[0].src = $(eve.currentTarget).next().text();
			$('#img').css('display','block');
			//console.log($(eve.currentTarget).next().text());
			
		});
		$('#tbody').on('mouseout','.photo',function(eve){
			//$('#img').css('top',(eve.currentTarget.top + eve.currentTarget.width)+'px');
			$('#img').css('display','none');
		});
	});
</script>
</html>